package com.woniuxy.cloud.userassembly.apiimpl;


import com.woniuxy.cloud.demo.Result;
import com.woniuxy.cloud.userassembly.exception.UserException;
import com.woniuxy.cloud.userassembly.param.SaveRoleResourcesParam;
import com.woniuxy.cloud.userassembly.param.SaveUserRoleParam;
import com.woniuxy.cloud.userassembly.service.Impl.RoleResourcesServiceImpl;
import com.woniuxy.cloud.userassembly.service.RoleResourcesService;
import com.woniuxy.cloud.userassembly.service.RoleService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 周川雄
 * @since 2022-01-26
 */
@RestController
@RequestMapping("/role-resources")
public class RoleResourcesController {
    @Resource
    private RoleResourcesService service;

    /**
     * 修改角色的接口授权
     *
     * @param arp
     * @return
     */
    @ApiOperation("修改角色的接口授权")
    @PostMapping("/saveRoleResources.do")
    public Result saveRoleResources(@RequestBody SaveRoleResourcesParam arp) {
        if (service.saveRoleResources(arp)) return Result.newInstance().setCode(200).setMsg("授权成功");
        throw new UserException("角色授权失败", 10407);

    }
}

